<?php

namespace app\admin\model;

use app\admin\traits\ScopeUniacid;
use app\common\model\TimeModel;

class KnscyTicketsPrice extends TimeModel
{

    protected $name = "tickets_price";


    protected $globalScope = ['uniacid'];
    use ScopeUniacid;
    
    public function getTypeIdList()
    {
        return ['1'=>'按时间段','2'=>'按周重复','3'=>'按日期',];
    }

    public function getStatusList()
    {
        return ['0'=>'禁用','1'=>'启用',];
    }

    public function getContentAttr($value, $data){
        if($data['type_id'] == 2 &&  $value!=='' && $value!==null){
            $week = [0=>'周日',1=>'周一',2=>'周二',3=>'周三',4=>'周四',5=>'周五',6=>'周六'];
            $days = explode(",", $value);
            $days = array_map(function($v) use($week ){ return  $week[$v] ;}, $days);
            return implode(",",$days);
        }
        return $value;
    }


}